id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Athenian: Variablesmod2

prev  |  next  |  chance

Determine if a is even or odd
by Tracy '23

def even_or_odd(a):     # give your function a name and parameter(s)
    if a % 2 == 0:
        return ('even') # what does it return? This will be what the user types when they predict the result.
    else:
        return ('odd')
Function Call  Return Value
even_or_odd(5)
even_or_odd(-1)
even_or_odd(0)
even_or_odd(6)
even_or_odd(5 + 3)
even_or_odd(61 - 6)

Experiment with this code on Gitpod.io

⬅ Back